﻿using System;
using System.Collections.Generic;
using System.Linq;
using Assist;
using Autodesk.Revit.DB;
using Autodesk.Revit.DB.Mechanical;
using Autodesk.Revit.DB.Plumbing;
using YArchitech.Revit;

namespace YArchitech.HVAC
{
	public class AssistSystemType
	{
		public bool JudgeNameContainTeShu(string name)
		{
			bool result = false;
			if (name.Contains("\\") || name.Contains(":") || name.Contains("{") || name.Contains("}") || name.Contains("[") || name.Contains("]") || name.Contains("|") || name.Contains(";") || name.Contains("<") || name.Contains(">") || name.Contains("?") || name.Contains("`") || name.Contains("~"))
			{
				result = true;
			}
			return result;
		}

        public void createDuctSystemFilter(Autodesk.Revit.DB.Document doc, string filterName, MechanicalSystemType systemTypeName, ElementId linePatternId, int lineWeight, Autodesk.Revit.DB.Color color)
		{
			bool flag = false;
			using (List<Element>.Enumerator enumerator = new FilteredElementCollector(doc).OfClass(typeof(ParameterFilterElement)).ToElements().ToList<Element>().GetEnumerator())
			{
				while (enumerator.MoveNext())
				{
					if (((ParameterFilterElement)enumerator.Current).Name == filterName)
					{
						flag = true;
						break;
					}
				}
			}
			if (!flag)
			{
				DuctType ductType = new FilteredElementCollector(doc).OfClass(typeof(DuctType)).FirstElement() as DuctType;
				Level level = new FilteredElementCollector(doc).OfClass(typeof(Level)).FirstElement() as Level;
				Duct duct = doc.CreateYJKDuct(new XYZ(0.0, 0.0, 0.0), new XYZ(1.0, 1.0, 1.0), systemTypeName.Id, ductType, level.Id);
				ParameterFilterElement parameterFilterElement = ParameterFilterElement.Create(doc, filterName, new List<ElementId>
				{
					new ElementId(-2008000),
					new ElementId(-2008010),
					new ElementId(-2008016),
					new ElementId(-2008123)
				});
				new FilteredElementCollector(doc);
				Parameter parameter = duct.get_Parameter(BuiltInParameter.RBS_DUCT_SYSTEM_TYPE_PARAM);
				parameterFilterElement.SetRules(new List<FilterRule>
				{
					ParameterFilterRuleFactory.CreateEqualsRule(parameter.Id, systemTypeName.Id)
				});
				FilteredElementCollector filteredElementCollector = new FilteredElementCollector(doc);
				filteredElementCollector.OfClass(typeof(Autodesk.Revit.DB.View));
				foreach (Autodesk.Revit.DB.View view in from Element f in filteredElementCollector
				where (f as Autodesk.Revit.DB.View).CanBePrinted
				select f as Autodesk.Revit.DB.View)
				{
					Dictionary<ElementId, KeyValuePair<bool, OverrideGraphicSettings>> dictionary = new Dictionary<ElementId, KeyValuePair<bool, OverrideGraphicSettings>>();
					if (!view.IsFilterApplied(parameterFilterElement.Id))
					{
						view.AddFilter(parameterFilterElement.Id);
					}
					OverrideGraphicSettings filterOverrides = view.GetFilterOverrides(parameterFilterElement.Id);
					filterOverrides.SetCutFillColor(color);
					filterOverrides.SetCutLineColor(color);
					filterOverrides.SetProjectionLineColor(color);
					filterOverrides.SetProjectionFillColor(color);
					filterOverrides.SetCutLinePatternId(linePatternId);
					filterOverrides.SetCutFillPatternId(linePatternId);
					filterOverrides.SetCutLineWeight(lineWeight);
					filterOverrides.SetProjectionLineWeight(lineWeight);
					KeyValuePair<bool, OverrideGraphicSettings> value = new KeyValuePair<bool, OverrideGraphicSettings>(true, filterOverrides);
					dictionary.Add(parameterFilterElement.Id, value);
					view.RemoveFilter(parameterFilterElement.Id);
					foreach (ElementId elementId in view.GetFilters())
					{
						KeyValuePair<bool, OverrideGraphicSettings> value2 = new KeyValuePair<bool, OverrideGraphicSettings>(view.GetFilterVisibility(elementId), view.GetFilterOverrides(elementId));
						dictionary.Add(elementId, value2);
						view.RemoveFilter(elementId);
					}
					foreach (KeyValuePair<ElementId, KeyValuePair<bool, OverrideGraphicSettings>> keyValuePair in dictionary)
					{
						ElementId key = keyValuePair.Key;
						KeyValuePair<bool, OverrideGraphicSettings> value3 = keyValuePair.Value;
						view.AddFilter(key);
						view.SetFilterOverrides(key, value3.Value);
						view.SetFilterVisibility(key, value3.Key);
					}
				}
				doc.Delete(duct.Id);
			}
		}

		public void createRiserPipeFilter(Autodesk.Revit.DB.Document doc, string filterName)
		{
			bool flag = false;
			ParameterFilterElement parameterFilterElement = null;
			foreach (Element element in new FilteredElementCollector(doc).OfClass(typeof(ParameterFilterElement)).ToElements().ToList<Element>())
			{
				ParameterFilterElement parameterFilterElement2 = (ParameterFilterElement)element;
				if (parameterFilterElement2.Name == filterName)
				{
					parameterFilterElement = parameterFilterElement2;
					flag = true;
					break;
				}
			}
			if (!flag)
			{
				List<ElementId> list = new List<ElementId>();
				list.Add(new ElementId(-2008044));
				FilteredElementCollector filteredElementCollector = new FilteredElementCollector(doc);
				PipingSystemType pipingSystemType = null;
				using (List<Element>.Enumerator enumerator = YJKElementFilter.GetElementByClass(typeof(PipingSystemType), doc).GetEnumerator())
				{
					if (enumerator.MoveNext())
					{
						pipingSystemType = (enumerator.Current as PipingSystemType);
					}
				}
				Pipe pipe = new HYCreatePipeHelper().DrawRiserPipe(new XYZ(55.0, 55.0, 55.0), new XYZ(57.0, 57.0, 57.0), doc, filteredElementCollector.OfClass(typeof(PipeType)).FirstElement() as PipeType, "100", pipingSystemType);
				parameterFilterElement = ParameterFilterElement.Create(doc, filterName, list);
				Parameter parameter = pipe.GetParameter("是否立管");
				if (parameter == null)
				{
					return;
				}
				parameterFilterElement.SetRules(new List<FilterRule>
				{
					ParameterFilterRuleFactory.CreateEqualsRule(parameter.Id, "是", true)
				});
				doc.Delete(pipe.Id);
			}
			FilteredElementCollector filteredElementCollector2 = new FilteredElementCollector(doc);
			filteredElementCollector2.OfClass(typeof(Autodesk.Revit.DB.View));
			foreach (Autodesk.Revit.DB.View view in from Element f in filteredElementCollector2
			where (f as Autodesk.Revit.DB.View).CanBePrinted
			select f as Autodesk.Revit.DB.View)
			{
				Dictionary<ElementId, KeyValuePair<bool, OverrideGraphicSettings>> dictionary = new Dictionary<ElementId, KeyValuePair<bool, OverrideGraphicSettings>>();
				if (!view.IsFilterApplied(parameterFilterElement.Id))
				{
					view.AddFilter(parameterFilterElement.Id);
				}
				OverrideGraphicSettings filterOverrides = view.GetFilterOverrides(parameterFilterElement.Id);
				filterOverrides.SetCutLineWeight(1);
				filterOverrides.SetProjectionLineWeight(1);
				KeyValuePair<bool, OverrideGraphicSettings> value = new KeyValuePair<bool, OverrideGraphicSettings>(true, filterOverrides);
				dictionary.Add(parameterFilterElement.Id, value);
				view.RemoveFilter(parameterFilterElement.Id);
				foreach (ElementId elementId in view.GetFilters())
				{
					KeyValuePair<bool, OverrideGraphicSettings> value2 = new KeyValuePair<bool, OverrideGraphicSettings>(view.GetFilterVisibility(elementId), view.GetFilterOverrides(elementId));
					dictionary.Add(elementId, value2);
					view.RemoveFilter(elementId);
				}
				foreach (KeyValuePair<ElementId, KeyValuePair<bool, OverrideGraphicSettings>> keyValuePair in dictionary)
				{
					ElementId key = keyValuePair.Key;
					KeyValuePair<bool, OverrideGraphicSettings> value3 = keyValuePair.Value;
					view.AddFilter(key);
					view.SetFilterOverrides(key, value3.Value);
					view.SetFilterVisibility(key, value3.Key);
				}
			}
		}

        public void createPipeSystemFilter(Autodesk.Revit.DB.Document doc, string filterName, PipingSystemType systemTypeName, ElementId linePatternId, int lineWeight, Autodesk.Revit.DB.Color color)
		{
			bool flag = false;
			using (List<Element>.Enumerator enumerator = new FilteredElementCollector(doc).OfClass(typeof(ParameterFilterElement)).ToElements().ToList<Element>().GetEnumerator())
			{
				while (enumerator.MoveNext())
				{
					if (((ParameterFilterElement)enumerator.Current).Name == filterName)
					{
						flag = true;
						break;
					}
				}
			}
			if (!flag)
			{
				List<ElementId> list = new List<ElementId>();
				list.Add(new ElementId(-2008044));
				list.Add(new ElementId(-2008049));
				list.Add(new ElementId(-2008055));
				list.Add(new ElementId(-2008122));
				FilteredElementCollector filteredElementCollector = new FilteredElementCollector(doc);
				PipingSystemType pipingSystemType = null;
				using (List<Element>.Enumerator enumerator = YJKElementFilter.GetElementByClass(typeof(PipingSystemType), doc).GetEnumerator())
				{
					if (enumerator.MoveNext())
					{
						pipingSystemType = (enumerator.Current as PipingSystemType);
					}
				}
				Pipe pipe = new HYCreatePipeHelper().DrawRiserPipe(new XYZ(55.0, 55.0, 55.0), new XYZ(57.0, 57.0, 57.0), doc, filteredElementCollector.OfClass(typeof(PipeType)).FirstElement() as PipeType, "100", pipingSystemType);
				ParameterFilterElement parameterFilterElement = ParameterFilterElement.Create(doc, filterName, list);
				new FilteredElementCollector(doc);
				Parameter parameter = pipe.get_Parameter(BuiltInParameter.RBS_PIPING_SYSTEM_TYPE_PARAM);
				parameterFilterElement.SetRules(new List<FilterRule>
				{
					ParameterFilterRuleFactory.CreateEqualsRule(parameter.Id, systemTypeName.Id)
				});
				FilteredElementCollector filteredElementCollector2 = new FilteredElementCollector(doc);
				filteredElementCollector2.OfClass(typeof(Autodesk.Revit.DB.View));
				foreach (Autodesk.Revit.DB.View view in from Element f in filteredElementCollector2
				where (f as Autodesk.Revit.DB.View).CanBePrinted
				select f as Autodesk.Revit.DB.View)
				{
					Dictionary<ElementId, KeyValuePair<bool, OverrideGraphicSettings>> dictionary = new Dictionary<ElementId, KeyValuePair<bool, OverrideGraphicSettings>>();
					if (!view.IsFilterApplied(parameterFilterElement.Id))
					{
						view.AddFilter(parameterFilterElement.Id);
					}
					OverrideGraphicSettings filterOverrides = view.GetFilterOverrides(parameterFilterElement.Id);
					filterOverrides.SetCutFillColor(color);
					filterOverrides.SetCutLineColor(color);
					filterOverrides.SetProjectionLineColor(color);
					filterOverrides.SetProjectionFillColor(color);
					filterOverrides.SetCutLinePatternId(linePatternId);
					filterOverrides.SetCutFillPatternId(linePatternId);
					filterOverrides.SetCutLineWeight(lineWeight);
					filterOverrides.SetProjectionLineWeight(lineWeight);
					KeyValuePair<bool, OverrideGraphicSettings> value = new KeyValuePair<bool, OverrideGraphicSettings>(true, filterOverrides);
					dictionary.Add(parameterFilterElement.Id, value);
					view.RemoveFilter(parameterFilterElement.Id);
					foreach (ElementId elementId in view.GetFilters())
					{
						KeyValuePair<bool, OverrideGraphicSettings> value2 = new KeyValuePair<bool, OverrideGraphicSettings>(view.GetFilterVisibility(elementId), view.GetFilterOverrides(elementId));
						dictionary.Add(elementId, value2);
						view.RemoveFilter(elementId);
					}
					foreach (KeyValuePair<ElementId, KeyValuePair<bool, OverrideGraphicSettings>> keyValuePair in dictionary)
					{
						ElementId key = keyValuePair.Key;
						KeyValuePair<bool, OverrideGraphicSettings> value3 = keyValuePair.Value;
						view.AddFilter(key);
						view.SetFilterOverrides(key, value3.Value);
						view.SetFilterVisibility(key, value3.Key);
					}
				}
				doc.Delete(pipe.Id);
			}
		}

        public void setSystemTypeMaterialColor(PipingSystemType pst, Autodesk.Revit.DB.Document doc, Autodesk.Revit.DB.Color color, bool isCreateFilter, ElementId linePatternId, int lineWeight)
		{
			string text = "HY" + pst.Name + "系统颜色";
			FilteredElementCollector filteredElementCollector = new FilteredElementCollector(doc);
			filteredElementCollector.OfCategory(BuiltInCategory.OST_Materials);
			FilteredElementIterator elementIterator = filteredElementCollector.GetElementIterator();
			elementIterator.Reset();
			Material material = null;
			while (elementIterator.MoveNext())
			{
				Element element = elementIterator.Current;
				Material material2 = element as Material;
				if (material2 != null && material2.Name == text)
				{
					material = material2;
					break;
				}
			}
			if (material == null)
			{
				material = (doc.GetElement(Material.Create(doc, text)) as Material);
			}
			material.Color = color;
			pst.get_Parameter(BuiltInParameter.MATERIAL_ID_PARAM).Set(material.Id);
			if (isCreateFilter)
			{
				this.createPipeSystemFilter(doc, "HY" + pst.Name, pst, linePatternId, lineWeight, color);
			}
		}

        public void setSystemTypeMaterialColor(MechanicalSystemType pst, Autodesk.Revit.DB.Document doc, Autodesk.Revit.DB.Color color, bool isCreateFilter, ElementId linePatternId, int lineWeight, bool bl = true)
		{
			if (bl && pst.Name.Contains(" "))
			{
				pst.Name = pst.Name.Substring(0, pst.Name.IndexOf(' '));
			}
			string text = "HY" + pst.Name + "系统颜色";
			FilteredElementCollector filteredElementCollector = new FilteredElementCollector(doc);
			filteredElementCollector.OfCategory(BuiltInCategory.OST_Materials);
			FilteredElementIterator elementIterator = filteredElementCollector.GetElementIterator();
			elementIterator.Reset();
			Material material = null;
			while (elementIterator.MoveNext())
			{
				Element element = elementIterator.Current;
				Material material2 = element as Material;
				if (material2 != null && material2.Name == text)
				{
					material = material2;
					break;
				}
			}
			if (material == null)
			{
				material = (doc.GetElement(Material.Create(doc, text)) as Material);
			}
			material.Color = color;
			RevitVersionFuncs.SetSurfacePatternColor(ref material, color);
			RevitVersionFuncs.SetCutPatternColor(ref material, color);
			pst.get_Parameter(BuiltInParameter.MATERIAL_ID_PARAM).Set(material.Id);
			if (bl && pst.Name.Contains(" "))
			{
				pst.Name = pst.Name.Substring(0, pst.Name.IndexOf(' '));
			}
			if (isCreateFilter)
			{
				this.createDuctSystemFilter(doc, "HY" + pst.Name, pst, linePatternId, lineWeight, color);
			}
		}

		public static PipingSystemType getPipingSystemTypeAccordName(string name, List<PipingSystemType> list)
		{
			PipingSystemType result = null;
			foreach (PipingSystemType pipingSystemType in list)
			{
				if (pipingSystemType.Name == name)
				{
					result = pipingSystemType;
					break;
				}
			}
			return result;
		}

		public static MechanicalSystemType getMechanicalSystemTypeAccordName(string name, List<MechanicalSystemType> list)
		{
			MechanicalSystemType result = null;
			foreach (MechanicalSystemType mechanicalSystemType in list)
			{
				if (mechanicalSystemType.Name == name)
				{
					result = mechanicalSystemType;
					break;
				}
			}
			return result;
		}

		public static string accordPiingSystemTypeNameGetSystemClass(PipingSystemType pst)
		{
			string result = "";
			if ((int)pst.SystemClassification == 16 || (int)pst.SystemClassification == 19 || (int)pst.SystemClassification == 20 || (int)pst.SystemClassification == 22)
			{
				result = "给排水系统";
			}
			if ((int)pst.SystemClassification == 24 || (int)pst.SystemClassification == 23 || (int)pst.SystemClassification == 25 || (int)pst.SystemClassification == 26)
			{
				result = "消防系统";
			}
			if ((int)pst.SystemClassification == 7 || (int)pst.SystemClassification == 8 || (int)pst.SystemClassification == 17)
			{
				result = "空调水系统";
			}
			return result;
		}

		public static string accordMechanicalSystemTypeNameGetSystemClass(MechanicalSystemType mst)
		{
			string result = "";
			if ((int)mst.SystemClassification == 1 || (int)mst.SystemClassification == 2 || (int)mst.SystemClassification == 3)
			{
				result = "空调风系统";
			}
			return result;
		}

		public static void SetSystemSimple(MechanicalSystemType mst)
		{
			string ductSystemTypeCH = AssistSystemType.GetDuctSystemTypeCH(mst.Name);
			string text;
			if (!(ductSystemTypeCH == "送风"))
			{
				if (!(ductSystemTypeCH == "回风"))
				{
					if (!(ductSystemTypeCH == "排风"))
					{
						text = "FG";
					}
					else
					{
						text = "PFG";
					}
				}
				else
				{
					text = "HFG";
				}
			}
			else
			{
				text = "SFG";
			}
			Parameter parameter = mst.get_Parameter(BuiltInParameter.RBS_SYSTEM_ABBREVIATION_PARAM);
			if (parameter.AsString() == "")
			{
				parameter.Set(text);
			}
		}

		public static void SetSystemSimple(PipingSystemType pst)
		{
			string pipeSystemTypeCH = AssistSystemType.GetPipeSystemTypeCH(pst.Name);
			uint num = YArchitech.Revit.PrivateImplementationDetails.ComputeStringHash(pipeSystemTypeCH);
			string text;
			if (num <= 2563745786u)
			{
				if (num <= 1366947159u)
				{
					if (num != 1229342730u)
					{
						if (num == 1366947159u)
						{
							if (pipeSystemTypeCH == "通风孔")
							{
								text = "TFK";
								goto IL_155;
							}
						}
					}
					else if (pipeSystemTypeCH == "家用热水")
					{
						text = "JYRS";
						goto IL_155;
					}
				}
				else if (num != 2187079225u)
				{
					if (num == 2563745786u)
					{
						if (pipeSystemTypeCH == "干式消防系统")
						{
							text = "GSXF";
							goto IL_155;
						}
					}
				}
				else if (pipeSystemTypeCH == "循环供水")
				{
					text = "XHGS";
					goto IL_155;
				}
			}
			else if (num <= 3914730892u)
			{
				if (num != 2731895364u)
				{
					if (num == 3914730892u)
					{
						if (pipeSystemTypeCH == "卫生设备")
						{
							text = "WSSB";
							goto IL_155;
						}
					}
				}
				else if (pipeSystemTypeCH == "循环回水")
				{
					text = "XHHS";
					goto IL_155;
				}
			}
			else if (num != 4079822120u)
			{
				if (num == 4199473803u)
				{
					if (pipeSystemTypeCH == "湿式消防系统")
					{
						text = "SSXF";
						goto IL_155;
					}
				}
			}
			else if (pipeSystemTypeCH == "家用冷水")
			{
				text = "JYLS";
				goto IL_155;
			}
			text = "SG";
			IL_155:
			Parameter parameter = pst.get_Parameter(BuiltInParameter.RBS_SYSTEM_ABBREVIATION_PARAM);
			if (parameter.AsString() == "")
			{
				parameter.Set(text);
			}
		}

		public static string GetDuctSystemTypeUS(string enumName)
		{
			uint num = YArchitech.Revit.PrivateImplementationDetails.ComputeStringHash(enumName);
			if (num <= 2230797665u)
			{
				if (num != 316708189u)
				{
					if (num != 1004253414u)
					{
						if (num == 2230797665u)
						{
							if (enumName == "其他通风")
							{
								return "OtherAir";
							}
						}
					}
					else if (enumName == "送风")
					{
						return "SupplyAir";
					}
				}
				else if (enumName == "回风")
				{
					return "ReturnAir";
				}
			}
			else if (num <= 3053837365u)
			{
				if (num != 2377983342u)
				{
					if (num == 3053837365u)
					{
						if (enumName == "全局")
						{
							return "Global";
						}
					}
				}
				else if (enumName == "管件")
				{
					return "Fitting";
				}
			}
			else if (num != 3336054724u)
			{
				if (num == 4088785633u)
				{
					if (enumName == "排风")
					{
						return "ExhaustAir";
					}
				}
			}
			else if (enumName == "未定义")
			{
				return "UndefinedSystemType";
			}
			return enumName;
		}

		public static string GetPipeSystemTypeUS(string chName)
		{
			uint num = YArchitech.Revit.PrivateImplementationDetails.ComputeStringHash(chName);
			if (num <= 2377983342u)
			{
				if (num <= 1204270209u)
				{
					if (num != 173937550u)
					{
						if (num != 806828493u)
						{
							if (num != 1204270209u)
							{
								goto IL_296;
							}
							if (!(chName == "其他消防系统"))
							{
								goto IL_296;
							}
							return "FireProtectOther";
						}
						else
						{
							if (!(chName == "其他"))
							{
								goto IL_296;
							}
							return "OtherPipe";
						}
					}
					else if (!(chName == "通气管"))
					{
						goto IL_296;
					}
				}
				else if (num <= 1366947159u)
				{
					if (num != 1229342730u)
					{
						if (num != 1366947159u)
						{
							goto IL_296;
						}
						if (!(chName == "通风孔"))
						{
							goto IL_296;
						}
					}
					else
					{
						if (!(chName == "家用热水"))
						{
							goto IL_296;
						}
						return "DomesticHotWater";
					}
				}
				else if (num != 2187079225u)
				{
					if (num != 2377983342u)
					{
						goto IL_296;
					}
					if (!(chName == "管件"))
					{
						goto IL_296;
					}
					return "Fitting";
				}
				else
				{
					if (!(chName == "循环供水"))
					{
						goto IL_296;
					}
					return "SupplyHydronic";
				}
			}
			else if (num <= 3053837365u)
			{
				if (num <= 2563745786u)
				{
					if (num != 2494559579u)
					{
						if (num != 2563745786u)
						{
							goto IL_296;
						}
						if (!(chName == "干式消防系统"))
						{
							goto IL_296;
						}
						return "FireProtectDry";
					}
					else if (!(chName == "通气"))
					{
						goto IL_296;
					}
				}
				else if (num != 2731895364u)
				{
					if (num != 3053837365u)
					{
						goto IL_296;
					}
					if (!(chName == "全局"))
					{
						goto IL_296;
					}
					return "Global";
				}
				else
				{
					if (!(chName == "循环回水"))
					{
						goto IL_296;
					}
					return "ReturnHydronic";
				}
			}
			else if (num <= 3914730892u)
			{
				if (num != 3675399567u)
				{
					if (num != 3914730892u)
					{
						goto IL_296;
					}
					if (!(chName == "卫生设备"))
					{
						goto IL_296;
					}
					return "Sanitary";
				}
				else
				{
					if (!(chName == "预作用消防系统"))
					{
						goto IL_296;
					}
					return "FireProtectPreaction";
				}
			}
			else if (num != 4079822120u)
			{
				if (num != 4199473803u)
				{
					goto IL_296;
				}
				if (!(chName == "湿式消防系统"))
				{
					goto IL_296;
				}
				return "FireProtectWet";
			}
			else
			{
				if (!(chName == "家用冷水"))
				{
					goto IL_296;
				}
				return "DomesticColdWater";
			}
			return "Vent";
			IL_296:
			return "UndefinedSystemType";
		}

		public static bool IsDuctOrPipeSystem(string system)
		{
			return system == "送风" || system == "回风" || system == "排风";
		}

		public static string GetSystemTypeUS(string enumName)
		{
			string text = AssistSystemType.GetPipeSystemTypeUS(enumName);
			if (text == enumName)
			{
				text = AssistSystemType.GetDuctSystemTypeUS(enumName);
			}
			return text;
		}

		public static string GetSystemTypeCH(string enumName)
		{
			string text = AssistSystemType.GetPipeSystemTypeCH(enumName);
			if (text == enumName)
			{
				text = AssistSystemType.GetDuctSystemTypeCH(enumName);
			}
			return text;
		}

		public static string GetDuctSystemTypeCH(string enumName)
		{
			uint num = YArchitech.Revit.PrivateImplementationDetails.ComputeStringHash(enumName);
			if (num <= 2603360416u)
			{
				if (num != 81264407u)
				{
					if (num != 1678934222u)
					{
						if (num == 2603360416u)
						{
							if (enumName == "Fitting")
							{
								return "管件";
							}
						}
					}
					else if (enumName == "Global")
					{
						return "全局";
					}
				}
				else if (enumName == "ExhaustAir")
				{
					return "排风";
				}
			}
			else if (num <= 3891676362u)
			{
				if (num != 3017983553u)
				{
					if (num == 3891676362u)
					{
						if (enumName == "UndefinedSystemType")
						{
							return "未定义";
						}
					}
				}
				else if (enumName == "ReturnAir")
				{
					return "回风";
				}
			}
			else if (num != 3995932714u)
			{
				if (num == 4199155463u)
				{
					if (enumName == "OtherAir")
					{
						return "其他通风";
					}
				}
			}
			else if (enumName == "SupplyAir")
			{
				return "送风";
			}
			return enumName;
		}

		public static string GetPipeSystemTypeCH(string enumName)
		{
			uint num = YArchitech.Revit.PrivateImplementationDetails.ComputeStringHash(enumName);
			if (num <= 2003677185u)
			{
				if (num <= 1524890971u)
				{
					if (num != 514019971u)
					{
						if (num != 842668758u)
						{
							if (num == 1524890971u)
							{
								if (enumName == "DomesticHotWater")
								{
									return "家用热水";
								}
							}
						}
						else if (enumName == "SupplyHydronic")
						{
							return "循环供水";
						}
					}
					else if (enumName == "ReturnHydronic")
					{
						return "循环回水";
					}
				}
				else if (num <= 1698412355u)
				{
					if (num != 1678934222u)
					{
						if (num == 1698412355u)
						{
							if (enumName == "FireProtectPreaction")
							{
								return "预作用消防系统";
							}
						}
					}
					else if (enumName == "Global")
					{
						return "全局";
					}
				}
				else if (num != 1807552510u)
				{
					if (num == 2003677185u)
					{
						if (enumName == "FireProtectDry")
						{
							return "干式消防系统";
						}
					}
				}
				else if (enumName == "Sanitary")
				{
					return "卫生设备";
				}
			}
			else if (num <= 2482186404u)
			{
				if (num != 2017692542u)
				{
					if (num != 2382714854u)
					{
						if (num == 2482186404u)
						{
							if (enumName == "FireProtectWet")
							{
								return "湿式消防系统";
							}
						}
					}
					else if (enumName == "DomesticColdWater")
					{
						return "家用冷水";
					}
				}
				else if (enumName == "Vent")
				{
					return "通风孔";
				}
			}
			else if (num <= 3313474090u)
			{
				if (num != 2603360416u)
				{
					if (num == 3313474090u)
					{
						if (enumName == "FireProtectOther")
						{
							return "其他消防系统";
						}
					}
				}
				else if (enumName == "Fitting")
				{
					return "管件";
				}
			}
			else if (num != 3891676362u)
			{
				if (num == 4225100969u)
				{
					if (enumName == "OtherPipe")
					{
						return "其他";
					}
				}
			}
			else if (enumName == "UndefinedSystemType")
			{
				return "未定义";
			}
			return enumName;
		}

		public static MEPSystemClassification GetMEPSystemClassificationByName(string name)
		{
			uint num = YArchitech.Revit.PrivateImplementationDetails.ComputeStringHash(name);
			if (num <= 2003677185u)
			{
				if (num <= 1041852919u)
				{
					if (num <= 498440003u)
					{
						if (num <= 394102708u)
						{
							if (num != 81264407u)
							{
								if (num == 394102708u)
								{
									if (name == "DataCircuit")
									{
                                        return (MEPSystemClassification)5;
									}
								}
							}
							else if (name == "ExhaustAir")
							{
                                return (MEPSystemClassification)3;
							}
						}
						else if (num != 487051712u)
						{
							if (num == 498440003u)
							{
								if (name == "Communication")
								{
                                    return (MEPSystemClassification)14;
								}
							}
						}
						else if (name == "SwitchTopology")
						{
                            return (MEPSystemClassification)27;
						}
					}
					else if (num <= 842668758u)
					{
						if (num != 514019971u)
						{
							if (num == 842668758u)
							{
								if (name == "SupplyHydronic")
								{
                                    return (MEPSystemClassification)7;
								}
							}
						}
						else if (name == "ReturnHydronic")
						{
                            return (MEPSystemClassification)8;
						}
					}
					else if (num != 1015958679u)
					{
						if (num == 1041852919u)
						{
							if (name == "Recirculation")
							{
                                return (MEPSystemClassification)21;
							}
						}
					}
					else if (name == "Telephone")
					{
                        return (MEPSystemClassification)9;
					}
				}
				else if (num <= 1698412355u)
				{
					if (num <= 1524890971u)
					{
						if (num != 1332168733u)
						{
							if (num == 1524890971u)
							{
								if (name == "DomesticHotWater")
								{
                                    return (MEPSystemClassification)19;
								}
							}
						}
						else if (name == "PowerUnBalanced")
						{
                            return (MEPSystemClassification)31;
						}
					}
					else if (num != 1678934222u)
					{
						if (num == 1698412355u)
						{
							if (name == "FireProtectPreaction")
							{
                                return (MEPSystemClassification)25;
							}
						}
					}
					else if (name == "Global")
					{
                        return (MEPSystemClassification)29;
					}
				}
				else if (num <= 1807552510u)
				{
					if (num != 1705189686u)
					{
						if (num == 1807552510u)
						{
							if (name == "Sanitary")
							{
                                return (MEPSystemClassification)16;
							}
						}
					}
					else if (name == "Storm")
					{
                        return (MEPSystemClassification)18;
					}
				}
				else if (num != 1905031246u)
				{
					if (num == 2003677185u)
					{
						if (name == "FireProtectDry")
						{
                            return (MEPSystemClassification)24;
						}
					}
				}
				else if (name == "NurseCall")
				{
                    return (MEPSystemClassification)12;
				}
			}
			else if (num <= 2818543061u)
			{
				if (num <= 2365059260u)
				{
					if (num <= 2060040202u)
					{
						if (num != 2017692542u)
						{
							if (num == 2060040202u)
							{
								if (name == "PowerBalanced")
								{
                                    return (MEPSystemClassification)30;
								}
							}
						}
						else if (name == "Vent")
						{
                            return (MEPSystemClassification)17;
						}
					}
					else if (num != 2189078486u)
					{
						if (num == 2365059260u)
						{
							if (name == "CableTrayConduit")
							{
                                return (MEPSystemClassification)32;
							}
						}
					}
					else if (name == "FireAlarm")
					{
                        return (MEPSystemClassification)11;
					}
				}
				else if (num <= 2482186404u)
				{
					if (num != 2382714854u)
					{
						if (num == 2482186404u)
						{
							if (name == "FireProtectWet")
							{
                                return (MEPSystemClassification)23;
							}
						}
					}
					else if (name == "DomesticColdWater")
					{
                        return (MEPSystemClassification)20;
					}
				}
				else if (num != 2603360416u)
				{
					if (num == 2818543061u)
					{
						if (name == "CondensateDrain")
						{
                            return (MEPSystemClassification)15;
						}
					}
				}
				else if (name == "Fitting")
				{
                    return (MEPSystemClassification)28;
				}
			}
			else if (num <= 3313474090u)
			{
				if (num <= 3271434715u)
				{
					if (num != 3017983553u)
					{
						if (num == 3271434715u)
						{
							if (name == "Security")
							{
                                return (MEPSystemClassification)10;
							}
						}
					}
					else if (name == "ReturnAir")
					{
                        return (MEPSystemClassification)2;
					}
				}
				else if (num != 3307450454u)
				{
					if (num == 3313474090u)
					{
						if (name == "FireProtectOther")
						{
                            return (MEPSystemClassification)26;
						}
					}
				}
				else if (name == "UndefinedSystemClassification")
				{
					return 0;
				}
			}
			else if (num <= 3995932714u)
			{
				if (num != 3933471113u)
				{
					if (num == 3995932714u)
					{
						if (name == "SupplyAir")
						{
                            return (MEPSystemClassification)1;
						}
					}
				}
				else if (name == "PowerCircuit")
				{
                    return (MEPSystemClassification)6;
				}
			}
			else if (num != 4143064631u)
			{
				if (num != 4199155463u)
				{
					if (num == 4225100969u)
					{
						if (name == "OtherPipe")
						{
                            return (MEPSystemClassification)22;
						}
					}
				}
				else if (name == "OtherAir")
				{
                    return (MEPSystemClassification)4;
				}
			}
			else if (name == "Controls")
			{
                return (MEPSystemClassification)13;
			}
			return 0;
		}
	}
}
